package com.campus.customer.feign;

import com.campus.common.bean.common.Resp;
import com.campus.customer.dto.*;
import com.wechat.pay.java.service.partnerpayments.jsapi.model.Transaction;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 支付服务Feign客户端
 *
 * @author ZhaoYuJie
 * @since 2025-01-15
 */
@FeignClient(name = "campus-payment", contextId = "payment-client", url = "${feign.campus-payment.url}", path = "/payment")
public interface PaymentFeignClient {

    /**
     * 创建微信支付订单
     *
     * @param request 支付订单请求
     * @return 支付订单响应
     */
    @PostMapping("/createPayOrder")
    Resp<PayOrderResponseDTO> createPayOrder(@RequestBody PayOrderRequestDTO request);

    /**
     * 关闭订单
     *
     * @param request 关闭订单请求
     * @return 操作结果
     */
    @PostMapping("/closeOrder")
    Resp<String> closeOrder(@RequestBody CloseOrderRequestDTO request);

    /**
     * 查询订单支付状态
     *
     * @param request 查询请求
     * @return 支付状态
     */
    @PostMapping("/queryOrderStatus")
    Resp<String> queryOrderStatus(@RequestBody OrderStatusQueryDTO request);

    /**
     * 查询订单详情
     *
     * @param request 查询请求
     * @return 订单详情
     */
    @PostMapping("/queryOrderDetail")
    Resp<Transaction> queryOrderDetail(@RequestBody OrderStatusQueryDTO request);
}